cmake_minimum_required(VERSION 3.20)

set(its 1 2 3 4 5 a b c d e A D)

# -- 列表长度
list(LENGTH its len)
message(STATUS "length = ${len}")

# -- 查找
# list(FIND its "Hello" result)
# message(STATUS "result = ${result}")

# -- 下标访问
# list(GET its 1 3 5 result)
# message(STATUS "result = ${result}")

# -- 胶水连接
# list(JOIN its "-" result)
# message(STATUS "result = ${result}")

# -- 获取子列表
# list(SUBLIST its 1 3 result)
# message(STATUS "result = ${result}")

# -- 操作列表
# -- 追加列表元素
# list(APPEND its "hzh")
# message(STATUS ${its})

# -- 过滤(包含/排除)
# list(FILTER its INCLUDE REGEX [0-9])
# list(FILTER its EXCLUDE REGEX [0-9])
# message(STATUS "${its}")

# -- 变换
# list(TRANSFORM its APPEND  ".cpp" AT 1 3 5 7 OUTPUT_VARIABLE result)
# message(STATUS "${its}")
# message(STATUS "${result}")

# -- 排序
# list(SORT its CASE INSENSITIVE ORDER ASCENDING)
list(SORT its COMPARE NATURAL CASE SENSITIVE ORDER ASCENDING)
message(STATUS "${its}")
